*Tehama Lopez Bunyasi   
*April 4, 2019
*This code reproduces the numerical results in 
*"The Role of Whiteness in the 2016 Presidential Primaries"
*In Perspectives on Politics


* Load data: "Lopez Bunyasi_Data for Perspectives.dta"


*Table 1.
tab PRES16

*Table 2. Note: the first three variables have already coded "DK" and "Never tried to get a job" as missing
tab GETJB_G
tab GETJB_PW
tab IDEOL_BATT_7
tab WHTADV
tab BLKADV
tab LATADV

*Note the values and corresponding categories for each variable:
*BASIC_GETJB_G: 1="Blacks have a better chance" 2="Equal chance" 3="Whites have a better chance"
*BASIC_GETJB_PW: 1="Being White has given R disadvantage" 2="Neither advantage nor disadvantage" 3="Being White has given R advantage"
*biIDEOL7 is a binary variable created from IDEOL_BATT_7 above
*PlainRaceResent is a scale
*WHTADV: 1="More advantages to being White" 2="More disadvantages to being White" 3="Don't know"
*LATADV: 1="More advantages to being Latinx" 2="More disadvantages to being Latinx" 3="Don't know"
*BLKADV: 1="More advantages to being Black" 2="More disadvantages to being Black" 3="Don't know"
*PartyID: 1="Democrat"   2="Independent"  3="Republican"
*Ideology: 1="Liberal"  2="Moderate"  3="Conservative"
*GENDER: 1="Female" 0="Male"
*Collegeormore: 1="having college education+" 0="no college graduate"
*HHI: 30 categories
*cut_change15yrunemploy: 1=negative 2="0% to less than 60%" 3="60%-100%" 4="101+%" 
*cut_change15yrforeignborn: 1=negative 2="0% to less than 20%" 3="20% to less than 40%" 4="40% to less than 60%" 5="60% to less than 100%" 6="100+%"
*all other variables are binary and self-explanatory

*Table 3.
*Hypothesis 1:   
logit  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Hypothesis 2A:
logit  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Hypothesis 2B:
logit  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Figure 1.
logit  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
margins, predict(pr) at(BASIC_GETJB_G=(1 2 3) PlainRaceResent=8.25 PartyID=2 Ideology=2 cut_change15yrunemploy=3  cut_change15yrforeignborn=6 GENDER=0  Collegeormore=0  HHI=6 Northeast=0 Midwest=1 South=0 BabyBoomSilentGen=0 GenX=1)

*Table 4.
*Hypothesis 3A
logit  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Hypothesis 3B
logit  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Figure 2.
logit  TRUMPvAll  biIDEOL7##c.HHI PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore Northeast Midwest South BabyBoomSilentGen GenX 
margins  biIDEOL7, at(HHI=(1(1)30))
marginsplot
*Note that the author edited color, axis labels, and tick marks 

*Table 5.
*Hypothesis 4A
logit  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Hypothesis 4B
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Hypothesis 4C
logit  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Hypothesis 4D
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Figure 3.
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
margins, predict(pr) at(WHTADV=(1 2 3) BLKADV=3 LATADV=3 PartyID=2 Ideology=2 cut_change15yrunemploy=3   cut_change15yrforeignborn=6 GENDER=0  Collegeormore=0  HHI=6 Northeast=0 Midwest=1 South=0 BabyBoomSilentGen=0 GenX=1)
*Note that the figure only accounts for values 1"More advantages to being White" and 2"More disadvantages to being White"


**
*Appendix*
**

*Table A instructions are located at end of dofile

*Table B displays the full output from the model used to produce Table 3.           

*Figure A.
logit  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
margins, predict(pr) at(BASIC_GETJB_PW=(1 2 3) PlainRaceResent=8.25 PartyID=2 Ideology=2 cut_change15yrunemploy=3   cut_change15yrforeignborn=6 GENDER=0  Collegeormore=0  HHI=6 Northeast=0 Midwest=1 South=0 BabyBoomSilentGen=0 GenX=1)

*Figure B.
logit  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
margins, predict(pr) at(BASIC_GETJB_PW=(1 2 3) LATADV=3 PartyID=2 Ideology=2 cut_change15yrunemploy=3   cut_change15yrforeignborn=6 GENDER=0  Collegeormore=0  HHI=6 Northeast=0 Midwest=1 South=0 BabyBoomSilentGen=0 GenX=1)


*Table C.
*Left column:
logit  TRUMPvAll  ib1.BASIC_GETJB_G ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_G ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Right column:
logit  TRUMPvAll  ib1.BASIC_GETJB_G ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_G ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 

*Table D displays the full output from the model used to produce Table 4.

*Table E. 
*Left column:
logit  TRUMPvAll  biIDEOL7##c.HHI PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  biIDEOL7##c.HHI PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore Northeast Midwest South BabyBoomSilentGen GenX 
*Right column:
logit  TRUMPvAll  biIDEOL7##c.HHI ib1.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7##c.HHI ib1.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore Northeast Midwest South BabyBoomSilentGen GenX

*Table F displays the full output from the model used to produce Table 5. 

*Table G.
*Left column (H1):
logit  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Shaded Right column (H1):
logit  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_G PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 

*Table H.
*Unshaded Left column (H2A):
logit  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Shaded left column (H2A):
logit  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX 
*Unshaded right column (H2B):
logit  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded right column (H2B):
logit  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib1.BASIC_GETJB_PW ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Table I.
*Unshaded left column (H3A):
logit  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded left column (H3A):
logit  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 PlainRaceResent ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Unshaded left column (H3B):
logit  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded left column (H3B):
logit  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  biIDEOL7 ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Table J.
*Unshaded left column (H4A):
logit  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded left column (H4A):
logit  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Unshaded right column (H4B):
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded right column (H4B):
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX


*Table K.
*Unshaded left column (H4C):
logit  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded left column (H4C):
logit  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Unshaded right column (H4D):
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology  ib1.cut_change15yrunemploy ib1.cut_change15yrforeignborn GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
*Shaded right column (H4D):
logit  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX
logistic  TRUMPvAll  ib2.WHTADV ib2.BLKADV ib2.LATADV ib3.PartyID ib3.Ideology GENDER Collegeormore HHI Northeast Midwest South BabyBoomSilentGen GenX

*Table A. *Note: In order to facilitate interpretation of each variable's relationship to the others, the author provides text for recoding the variables for the sole purpose of producing this correlation matrix. See coding language below.*
recode WHTADV 1=3 2=1 3=2
recode BLKADV 1=3 2=1 3=2
recode LATADV 1=3 2=1 3=2
pwcorr BASIC_GETJB_G BASIC_GETJB_PW WHTADV BLKADV LATADV IDEOL_BATT_7 PlainRaceResent, obs sig
